import React, {Component} from 'react'
import {AsyncStorage, StatusBar} from 'react-native';
import StartupNavigator from './src/navigator/startupNavigator'
import Redux from './src/reducer/reducer'
import {Provider} from 'react-redux'
import {createStore} from 'redux'

let store = createStore(Redux)
export default class App extends Component {
    constructor(props) {
        StatusBar.setBarStyle('dark-content', true)
        super(props)
    }

    componentDidMount() {
        AsyncStorage.getItem('isFirst', (error, result) => {
            if (result == 'false') {
                console.log('不是第一次打开');
            } else {
                console.log('第一次打开');
                // 存储
                AsyncStorage.setItem('isFirst', 'false', (error) => {
                    if (error) {
                        console.log('已存储');
                    }
                });
            }
        });
    }

    render() {
        return (
            <Provider store={store}>
                <StartupNavigator/>
            </Provider>
        )
    }

}

